package mysql

import "gorm.io/gorm"

type Order struct {
	gorm.Model
	UserId    int64   `gorm:"type:int(10);not null;"`
	Numbering string  `gorm:"type:varchar(50);not null;"`
	Title     string  `gorm:"type:varchar(50);not null;"`
	Times     string  `gorm:"type:varchar(50);not null;"`
	Status    string  `gorm:"type:varchar(30);not null;"`
	Total     float64 `gorm:"type:decimal(10,2);not null;"`
}

func (o *Order) Order() error {
	return DB.Create(&o).Error
}

type OrderAdd struct {
	gorm.Model
	GoodId  int64   `gorm:"type:int(10);not null;"`
	OrderId int64   `gorm:"type:int(10);not null;"`
	Title   string  `gorm:"type:varchar(50);not null;"`
	Status  string  `gorm:"type:varchar(30);not null;"`
	Num     int64   `gorm:"type:int(10);not null;"`
	Price   float64 `gorm:"type:decimal(10,2);not null;"`
}

func (o *OrderAdd) OrderAdd() error {
	return DB.Create(&o).Error
}
